home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Telnet / NCSA / tn3270 2.3d26 source / tn3270 / prt.c < prev    next >
Text File  |  1991-01-21  |  3KB  |  131 lines

  1. /*
  2.  *  tn3270 for the Macintosh Source Code
  3.  *  Brown University Computing and Information Services
  4.  *  Version 2.3d21, January 17, 1991
  5.  *  Copyright (c) 1988, 1989, 1990, 1991 by Brown University and by
  6.  *  Peter John DiCamillo.
  7.  *
  8.  *  Permission is granted to any individual or institution to use, copy,
  9.  *  or redistribute the binary version of this software and its
  10.  *  documentation provided this notice and the copyright notices are
  11.  *  retained.  Permission is granted to any individual or non-profit
  12.  *  institution to use, copy, modify, or redistribute the source files
  13.  *  of this software provided this notice and the copyright notices are
  14.  *  retained.  This software may not be distributed for profit, either
  15.  *  in original form or in derivative works, nor can the source be
  16.  *  distributed to other than an individual or a non-profit institution.
  17.  *  Any  individual or group interested in seeing and/or using these
  18.  *  source files but who are prevented from doing so by the above
  19.  *  constraints should contact Don Wolfe, Assistant Vice-President for
  20.  *  Computer Systems at Brown University, (401) 863-7250, for possible
  21.  *  software licensing of the source developed at Brown.
  22.  *
  23.  *  Brown University and Peter John DiCamillo make no representations
  24.  *  about the suitability of this software for any purpose.
  25.  *
  26.  *  BROWN UNIVERSITY AND PETER JOHN DICAMILLO GIVE NO WARRANTY, EITHER
  27.  *  EXPRESS OR IMPLIED, FOR THE PROGRAM AND/OR DOCUMENTATION PROVIDED,
  28.  *  INCLUDING, WITHOUT LIMITATION, WARRANTY OF MERCHANTABILITY AND
  29.  *  WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE.
  30.  *
  31.  */
  32.  
  33. #define __SEG__ vmxfer
  34. #include "maclib.h"
  35. #include "termdef.h"
  36. #include "globals.h"
  37.  
  38. extern short hpixsize, vpixsize;
  39.  
  40. pgsetup()
  41. {
  42. if (hPrint == 0) {
  43.     SysBeep(1);
  44.     return;
  45.     }
  46. if (prtinit == 0) {
  47.     PrOpen();
  48.     PrintDefault(hPrint);
  49.     prtinit = 1;
  50.     }
  51. PrStlDialog(hPrint);
  52. }
  53.  
  54. prscreen()
  55. {
  56. TPPrPort prtport;
  57. GrafPtr gp;
  58. TPrStatus prStatus;
  59.  
  60. if (hPrint == 0) {
  61.     SysBeep(1);
  62.     return;
  63.     }
  64. if (prtinit == 0) {
  65.     PrOpen();
  66.     PrintDefault(hPrint);
  67.     prtinit = 1;
  68.     }
  69. if (!PrJobDialog(hPrint)) return; 
  70.  
  71. /* main printing code (not loop, since only one page) */
  72. GetPort(&gp);
  73. setdoctitle("3270 Screen Dump");
  74. prtport = PrOpenDoc(hPrint, 0L, 0L);
  75. if (PrError() == noErr) {
  76.     PrOpenPage(prtport, 0L);        /* start new page */
  77.     if (PrError() == noErr) prtdraw();
  78.     PrClosePage(prtport);
  79.     }
  80. PrCloseDoc(prtport);
  81. if (((*hPrint)->prJob.bJDocLoop == bSpoolLoop) && (PrError() == noErr))
  82.     PrPicFile(hPrint, 0L, 0L, 0L, &prStatus);
  83. if (PrError() != noErr) stoperr(305);
  84. SetPort(gp);
  85. }
  86.  
  87. prtdraw()
  88. {
  89. char colorsave;
  90. GrafPtr gp;
  91.  
  92. TextFont(stdfont);
  93. PicComment(155, 0, 0L);        /* line layout off */
  94.  
  95.     /* set constants for 12-point, and if page is not big enough,
  96.        use 9-point instead                                        */
  97. setmode(cur_rows, cur_cols, 12, 0);
  98. TextSize(12);
  99. GetPort(&gp);
  100. if ((hpixsize > (gp->portRect).right) ||
  101.     (vpixsize > (gp->portRect).bottom)) {
  102.     setmode(cur_rows, cur_cols, 9, 0);
  103.     TextSize(9);
  104.     }
  105.  
  106.     /* set colormac flag according to printing grafport */
  107. colorsave = colormac;
  108. colormac = ((gp->portBits.rowBytes & 0xc000) == 0xc000);
  109. writescr(1);
  110.  
  111.     /* restore settings by calling setmode */
  112. setmode(cur_rows, cur_cols, cur_ptsize, ses_windmax);
  113.  
  114.     /* restore colormac flag */
  115. colormac = colorsave;
  116. }
  117.  
  118. setdoctitle(s)
  119. char * s;
  120. {
  121. WindowPtr wp;
  122. char titlesave[256];
  123.  
  124. wp = FrontWindow();
  125. if (wp == 0) return;
  126. GetWTitle(wp, titlesave);
  127. SetWTitle(wp, s);
  128. PrValidate(hPrint);
  129. SetWTitle(wp, titlesave);
  130. }
  131.